package com.lzh.lzhframework.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 反馈类型枚举（1系统问题 2内容问题 3我要吐槽）
 *
 * @author luzhiheng
 * @date 2023-11-30
 */

public enum FeedbackTypeEnum {

    SYSTEM_PROBLEM(1, "系统问题"),
    CONTENT_PROBLEM(2, "内容问题"),
    TEASE(3, "我要吐槽"),
    ;

    public final Integer code;
    public final String value;

    FeedbackTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String codeToValue(Integer code) {
        if (null == code) {
            return null;
        }
        for (FeedbackTypeEnum ruleColorEnum : FeedbackTypeEnum.values()) {
            if (ruleColorEnum.code.equals(code)) {
                return ruleColorEnum.getValue();
            }
        }
        return null;
    }

    public static Integer valueToCode(String value) {
        if (StringUtils.isEmpty(value)) {
            return null;
        }
        for (FeedbackTypeEnum feedbackStatusEnum : FeedbackTypeEnum.values()) {
            if (feedbackStatusEnum.value.equals(value)) {
                return feedbackStatusEnum.code;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }
}
